# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`/"$link"
    fi
done

PRGDIR=`dirname "$PRG"`

CALSSPATH=$PRGDIR/WEB-INF/lib/xiangqibook.jar
CALSSPATH=$CALSSPATH:$PRGDIR/WEB-INF/lib/commons-collections-3.1.jar
CALSSPATH=$CALSSPATH:$PRGDIR/WEB-INF/lib/jcaptcha-all-1.0-RC3.jar
CALSSPATH=$CALSSPATH:$PRGDIR/WEB-INF/lib/log4j-1.2.17.jar
CALSSPATH=$CALSSPATH:$PRGDIR/WEB-INF/lib/mysql-connector-java-5.1.15-bin.jar

java -cp $CALSSPATH com.ltv.xiangqibook.dbtool.GameGenerator $PRGDIR
java -cp $CALSSPATH com.ltv.xiangqibook.dbtool.DirectoryGenerator $PRGDIR
